<?php
apf_require_class('Dao_DAO');

class Dao_Attendance_AccessDayRecord extends DAO{
	public function get_table_name(){
		return 'access_day_record';
	}

	public function get_read_pdo_name(){
		return 'attendance_slave';
	}

	public function get_write_pdo_name(){
		return 'attendance_master';
	}

	public function get_table_pk(){
		return 'id';
	}

    /**
     * 获取用户七天内的考勤记录 
     * 
     * @param mixed $user_id 
     * @param int $start 
     * @param int $end 
     * @access public
     * @return void
     */
    public function get_day_record($user_id,$start = 0,$end = 0) {
        $result = array();
        if(empty($user_id)) {
            return $result;
        }
        $sql = "SELECT access_date,start_work,end_work FROM access_day_record WHERE user_id = $user_id AND access_date >= $start AND access_date <= $end ORDER BY access_date DESC"; 
        $tmp = $this->find_by_sql($sql);
        if($tmp) {
            $result = $tmp;
        }
        return $result;
    }

}
